import tourist from '../src/data/service/tourist.json'
import serviceLog from '../src/data/service/serviceLog.json'
import chat from '../src/data/service/chat.json';
import getList from '../src/data/service/List.json'
export default {
    // 游客列表
    "GET /getTourist":tourist,
    // 服务记录
    "GET /getserviceLog":(req:any,res:any)=>{
        const { search } = req.query;
        if(search)
        {
            const arr = serviceLog.data.filter((item:any)=>{
                return item.kefu_name.includes(search)
            })
             res.send(arr)
        }
        else 
        {
            res.send(serviceLog.data)
        }   
    },
    // 服务记录
    "GET /getChat":(req:any,res:any)=>{
        const { search } = req.query;
        if(search)
        {
            const arr = chat.data.filter((item:any)=>{
                return item.from_name.includes(search)
            })
             res.send(arr)
        }
        else 
        {
            res.send(chat.data)
        }   
    },
     // 客服列表
     "GET /getList":(req:any,res:any)=>{
        const { search } = req.query;
        if(search)
        {
            const arr = getList.data.filter((item:any)=>{
                return item.kefu_name.includes(search)
            })
             res.send(arr)
        }
        else 
        {
            res.send(getList.data)
        }   
    },

    // 客服列表筛选
    "GET /getListshai":(req:any,res:any)=>{
        const { option } = req.query;
        if(option == 'ing')
        {
            const arr = getList.data.filter((item:any)=>{
                return item.online_status == 1
            })
            res.send(arr);
        }
        else if(option == 'out')
        {
            const brr = getList.data.filter((item:any)=>{
                return item.online_status == 2
            })
            res.send(brr);
        }
        else 
        {
            res.send(getList.data)
        }
    },

}